package com.zadtek.sharkRider.frame;

import java.util.ArrayList;

import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;

import android.util.Log;

import com.zadtek.sharkRider.activity.data.DeliveryOrderData;
import com.zadtek.sharkRider.activity.data.MytjData;
import com.zadtek.sharkRider.activity.data.NewOrderData;
import com.zadtek.sharkRider.activity.data.NewVersionData;
import com.zadtek.sharkRider.activity.data.OrderDeliveryData;
import com.zadtek.sharkRider.activity.data.OrderDeliveryItemData;
import com.zadtek.sharkRider.activity.data.OrderNewData;
import com.zadtek.sharkRider.activity.data.OrderNewHelpData;
import com.zadtek.sharkRider.activity.data.OrderNewItemData;
import com.zadtek.sharkRider.activity.data.OrderOverData;
import com.zadtek.sharkRider.activity.data.OrderWaitData;
import com.zadtek.sharkRider.activity.data.OrderWaitItemData;
import com.zadtek.sharkRider.activity.data.OrderdetailData;
import com.zadtek.sharkRider.activity.data.OrderdetailFood;
import com.zadtek.sharkRider.activity.data.OrderdetailSite;
import com.zadtek.sharkRider.activity.data.OrderoverDay;
import com.zadtek.sharkRider.activity.data.OrderoverOrd;
import com.zadtek.sharkRider.activity.data.PaihData;
import com.zadtek.sharkRider.activity.data.PushUserData;
import com.zadtek.sharkRider.activity.data.QiangDanData;
import com.zadtek.sharkRider.activity.data.SygOrdOverData;
import com.zadtek.sharkRider.activity.data.SygOrdetailData;
import com.zadtek.sharkRider.activity.data.UserData;
import com.zadtek.sharkRider.activity.data.UserDetailsData;
import com.zadtek.sharkRider.activity.data.WaitQuOrderData;

/**
 * Josn解析帮助
 * 
 */
public class JsonProcessHelper {

	/**
	 * 解析推送给用户的数据
	 * 
	 * @param pushContent
	 * @return
	 */
	public static PushUserData jsonProcess_getPushData(String pushContent) {
		PushUserData pushuserData = null;
		try {
			JSONObject resultJSON = new JSONObject(pushContent);
			pushuserData = new PushUserData();
			// pushuserData.setXyrr_qsid(resultJSON.getString("xyrr_qsid"));
			pushuserData.setQs_type(resultJSON.getString("qs_type"));
			pushuserData.setNewprompt(resultJSON.getString("newprompt"));
			pushuserData.setAdminid(resultJSON.getString("adminid"));
			pushuserData.setSubject(resultJSON.getString("subject"));

		} catch (JSONException e) {
			e.printStackTrace();
			return null;
		}
		return pushuserData;
	}

	/**
	 * 快递登录
	 * 
	 * @param ince
	 * @param uname
	 * @param passwd
	 */
	public static UserData jsonProcess_user_login(String ince, String uname,
			String passwd) {
		String content = WebHttpHelper.login_qs(ince, uname, passwd);
		UserData userdata = null;
		if (!"".equals(content) && content != null) {
			JSONObject resultJSON;
			try {
				resultJSON = new JSONObject(content);
				if ("1".equals(resultJSON.getString("status"))
						&& !"".equals(resultJSON.getString("info"))) {
					userdata = new UserData();
					userdata.setStatus("1");
					userdata.setMessage(resultJSON.getString("sucess"));

					resultJSON = resultJSON.getJSONObject("info");
					userdata.setUid(resultJSON.getString("uid"));
					userdata.setRealname(resultJSON.getString("realname"));
					userdata.setPhone(resultJSON.getString("phone"));
					userdata.setAccount(resultJSON.getString("account"));
					userdata.setClose(resultJSON.getString("close"));
					userdata.setQsstatus(resultJSON.getString("status"));

				} else if ("0".equals(resultJSON.getString("status"))) {
					// 登录错误
					userdata = new UserData();
					userdata.setStatus("0");
					userdata.setMessage(resultJSON.getString("fail"));
				}
			} catch (JSONException e) {
				e.printStackTrace();
				return null;
			}

		} else {
			// 失败处理
			return null;
		}
		return userdata;
	}


	/**
	 * 新任务——待抢单列表——随意购
	 * @param ince
	 * @param lat
	 * @param lng
	 * @param uid
	 * @param rr_last_id
	 * @param help_last_id
	 * @return
	 */
	public static NewOrderData jsonProcess_getOrderList(String ince,
			String lat, String lng,String uid,String rr_last_id,String help_last_id) {
		ArrayList<OrderNewData> NewDataList = null;
		ArrayList<OrderNewItemData> NewItemList = null;
		ArrayList<OrderNewHelpData> NewHelpList = null;
		NewOrderData OrderDatas =null;
		String content = WebHttpHelper.getOrderList(ince, lat, lng,uid,rr_last_id,help_last_id);
		if (!"".equals(content) && content != null) {
			OrderNewData NewData = null;
			OrderNewItemData NewItemData = null;
			OrderNewHelpData helpData = null;
			JSONObject resultJSON, resultJSON1,resultJSON2;
			try {
				resultJSON = new JSONObject(content);
				String status = resultJSON.getString("status");
				if ("1".equals(status)) {
					OrderDatas = new NewOrderData();
					String message = resultJSON.getString("sucess");
					String rrlastid =resultJSON.getString("rr_last_id");
					String helplastid =resultJSON.getString("help_last_id");
					OrderDatas.setStatus(status);
					OrderDatas.setMessage(message);
					OrderDatas.setRr_last_id(rrlastid);
					OrderDatas.setHelp_last_id(helplastid);
					JSONArray jsonArray = resultJSON.getJSONArray("list");
					JSONArray jsonArray2 = resultJSON.getJSONArray("hlist");
					int iSize = jsonArray.length();
					int iSize2 = jsonArray2.length();
					if (iSize > 0 ) {
						NewDataList = new ArrayList<OrderNewData>();
						for (int i = 0; i < iSize; i++) {
							resultJSON = jsonArray.getJSONObject(i);
							NewData = new OrderNewData();
							NewData.setMainid(resultJSON.getString("mainid"));
							NewData.setSendaddress(resultJSON
									.getString("sendaddress"));
							NewData.setAdd_time(resultJSON
									.getString("add_time"));
							NewData.setTotal(resultJSON.getString("total"));
							NewData.setReturnpay(resultJSON
									.getString("returnpay"));
							try {
								NewData.setTime_limit(resultJSON
										.getString("time_limit"));
							} catch (Exception e1) {
								// TODO Auto-generated catch block
								e1.printStackTrace();
							}
							try {
								NewData.setAddress_road(resultJSON
										.getString("address_road"));	//用户详细地址
							} catch(Exception e){}
							NewData.setStatus01(status);
							NewData.setMessage(message);

							if (!"".equals(resultJSON.getString("items"))) {
								JSONArray jsonArray1 = resultJSON
										.getJSONArray("items");
								int iSize1 = jsonArray1.length();
								NewItemList = new ArrayList<OrderNewItemData>();
								for (int j = 0; j < iSize1; j++) {
									resultJSON1 = jsonArray1.getJSONObject(j);
									NewItemData = new OrderNewItemData();
									NewItemData.setMain_id(resultJSON1
											.getString("main_id"));
									NewItemData.setPay_money(resultJSON1
											.getString("pay_money"));
									NewItemData.setOrder_id(resultJSON1
											.getString("order_id"));
									NewItemData.setAddtime(resultJSON1
											.getString("addtime"));
									NewItemData.setPay_time(resultJSON1
											.getString("pay_time"));
									NewItemData.setStatus(resultJSON1
											.getString("status"));
									NewItemData.setUid(resultJSON1
											.getString("uid"));
									NewItemData.setSendstatus(resultJSON1
											.getString("sendstatus"));
									NewItemData.setSite_name(resultJSON1
											.getString("site_name"));
									NewItemData.setShopaddress(resultJSON1
											.getString("shopaddress"));
									NewItemData.setLocation(resultJSON1
											.getString("location"));
									NewItemData.setFood_amount(resultJSON1
											.getString("food_amount"));
									try {
										NewItemData.setPhone_addr(resultJSON1
												.getString("phone_addr"));	//用户经纬度
									} catch(Exception e){}
									NewItemList.add(NewItemData);
								}
								NewData.setOrderItemList(NewItemList);
							}
							NewDataList.add(NewData);
						}
						
						OrderDatas.setOrdernewdata(NewDataList);
					}else {
						NewDataList = new ArrayList<OrderNewData>();
						NewData = new OrderNewData();
						NewData.setStatus01("0");
						NewData.setMessage(message);
						NewDataList.add(NewData);
						OrderDatas.setOrdernewdata(NewDataList);
					}
					
					if(iSize2>0){
						NewHelpList = new ArrayList<OrderNewHelpData>();
						for (int i = 0; i < iSize2; i++) {
							resultJSON2 = jsonArray2.getJSONObject(i);
							helpData = new OrderNewHelpData();
							helpData.setSend_address(resultJSON2
									.getString("send_address"));
							helpData.setHelp_addtime(resultJSON2
									.getString("add_time"));
							helpData.setShipping_fee(resultJSON2
									.getString("shipping_fee"));
							helpData.setType(resultJSON2
										.getString("type"));	
							helpData.setHelp_order_id(resultJSON2
										.getString("order_id"));	
							helpData.setTitle(resultJSON2
										.getString("title"));	
							helpData.setOrder_mark(resultJSON2
										.getString("order_mark"));	
							helpData.setUname(resultJSON2
										.getString("uname"));	
							helpData.setPhone(resultJSON2
										.getString("phone"));	
							helpData.setFee(resultJSON2
										.getString("fee"));	
							helpData.setVoucher_fee(resultJSON2
										.getString("voucher_fee"));	
							helpData.setPrice(resultJSON2
										.getString("price"));	
							helpData.setPlan_price(resultJSON2
										.getString("plan_price"));	
							helpData.setType_get_address_name(resultJSON2
										.getString("type_get_address_name"));	
							helpData.setGet_address(resultJSON2
										.getString("get_address"));	
							helpData.setPercentage(resultJSON2
									.getString("percentage"));	
							helpData.setLocation_send(resultJSON2
									.getString("location"));	
							helpData.setLocation_get(resultJSON2
									.getString("location_get"));	
							helpData.setMap_location(resultJSON2
									.getString("map_location"));	
							helpData.setStatus("1");	
								
							NewHelpList.add(helpData);
						}
						OrderDatas.setNewhelpData(NewHelpList);
					} else {
						NewHelpList = new ArrayList<OrderNewHelpData>();
						helpData = new OrderNewHelpData();
						helpData.setStatus("0");
						helpData.setMessage(message);
						NewHelpList.add(helpData);
						OrderDatas.setNewhelpData(NewHelpList);
					}
					
					
					
				} else if ("0".equals(status)) {
					OrderDatas = new NewOrderData();
					String message = resultJSON.getString("sucess");
					OrderDatas.setStatus(status);
					OrderDatas.setMessage(message);
				}
			} catch (JSONException e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
				return null;
			}

		} else {
			// 失败处理
			return null;
		}

		return OrderDatas;

	}
	
	
	/**
	 * 待取货列表
	 * 
	 * @param ince
	 * @param emp_id
	 * @return
	 */
	public static WaitQuOrderData jsonProcess_getGetorderList(
			String ince, String emp_id) {
		WaitQuOrderData waitOderData =null;
		ArrayList<OrderWaitData> WaitDataList = null;
		ArrayList<OrderWaitItemData> WaitItemList = null;
		ArrayList<OrderNewHelpData> WaitHelpList = null;
		String content = WebHttpHelper.getGetorderList(ince, emp_id);
		if (!"".equals(content) && content != null) {
			OrderWaitData WaitData = null;
			OrderNewHelpData helpData =null;
			OrderWaitItemData WaitItemData = null;
			JSONObject resultJSON, resultJSON1,resultJSON2;
			try {
				resultJSON = new JSONObject(content);
				String status = resultJSON.getString("status");
				if ("1".equals(resultJSON.getString("status"))) {
					String message = resultJSON.getString("sucess");
					JSONArray jsonArray = resultJSON.getJSONArray("list");
					JSONArray jsonArray2 = resultJSON.getJSONArray("hlist");
					int iSize = jsonArray.length();
					int iSize2 = jsonArray2.length();
					waitOderData = new WaitQuOrderData();
					waitOderData.setStatus(status);
					waitOderData.setMessage(message);
					if (iSize > 0) {
						WaitDataList = new ArrayList<OrderWaitData>();
						for (int i = 0; i < iSize; i++) {
							resultJSON = jsonArray.getJSONObject(i);
							WaitData = new OrderWaitData();
							WaitData.setTotal(resultJSON.getString("total"));
							WaitData.setItemid(resultJSON.getString("itemid"));
							WaitData.setMain_id(resultJSON.getString("main_id"));
							WaitData.setEmp_id(resultJSON.getString("emp_id"));
							WaitData.setCreat_time(resultJSON
									.getString("creat_time"));
							WaitData.setAdd_time(resultJSON
									.getString("add_time"));
							WaitData.setGet_time(resultJSON
									.getString("get_time"));
							WaitData.setSend_time(resultJSON
									.getString("send_time"));
							WaitData.setReturnpay(resultJSON
									.getString("returnpay"));
							WaitData.setSendaddress(resultJSON
									.getString("sendaddress"));
							try {
								WaitData.setAddress_road(resultJSON
										.getString("address_road"));	//用户详细地址
							} catch (Exception e1) {
								// TODO Auto-generated catch block
								e1.printStackTrace();
							}
							WaitData.setStatus(resultJSON.getString("status"));
							WaitData.setStatus01(status);
							WaitData.setMessage(message);

							if (!"".equals(resultJSON.getString("items"))) {
								JSONArray jsonArray1 = resultJSON
										.getJSONArray("items");
								int iSize1 = jsonArray1.length();

								WaitItemList = new ArrayList<OrderWaitItemData>();
								for (int j = 0; j < iSize1; j++) {
									resultJSON1 = jsonArray1.getJSONObject(j);
									WaitItemData = new OrderWaitItemData();
									WaitItemData.setOrder_id(resultJSON1
											.getString("order_id"));
									WaitItemData.setSite_name(resultJSON1
											.getString("site_name"));
									WaitItemData.setSite_addr(resultJSON1
											.getString("site_addr"));
									WaitItemData.setLocation(resultJSON1
											.getString("location"));
									WaitItemData.setUname(resultJSON1
											.getString("uname"));
									WaitItemData.setPhone(resultJSON1
											.getString("phone"));
									WaitItemData.setAdd_time(resultJSON1
											.getString("add_time"));
									WaitItemData.setPaytype(resultJSON1
											.getString("paytype"));
									WaitItemData.setSite_phone(resultJSON1
											.getString("site_phone"));
									WaitItemData.setFood_amount(resultJSON1
											.getString("food_amount"));
									WaitItemData.setStatus(resultJSON1
											.getString("status"));
									try {
										WaitItemData.setPhone_addr(resultJSON1
												.getString("phone_addr"));	//用户经纬度
									} catch(Exception e){}
									WaitItemList.add(WaitItemData);
								}
								WaitData.setOrderItemList(WaitItemList);
							}

							WaitDataList.add(WaitData);
						}
						waitOderData.setWaitdata(WaitDataList);
					} else {
						WaitDataList = new ArrayList<OrderWaitData>();
						WaitData = new OrderWaitData();
						WaitData.setStatus01("0");
						WaitData.setMessage(message);
						WaitDataList.add(WaitData);
						waitOderData.setWaitdata(WaitDataList);
					}
					
					if(iSize2>0){
						WaitHelpList = new ArrayList<OrderNewHelpData>();
						for (int i = 0; i < iSize2; i++) {
							resultJSON2 = jsonArray2.getJSONObject(i);
							helpData = new OrderNewHelpData();
							helpData.setSend_address(resultJSON2
									.getString("send_address"));
							helpData.setHelp_addtime(resultJSON2
									.getString("add_time"));
							helpData.setShipping_fee(resultJSON2
									.getString("shipping_fee"));
							helpData.setType(resultJSON2
										.getString("type"));	
							helpData.setHelp_order_id(resultJSON2
										.getString("order_id"));	
							helpData.setTitle(resultJSON2
										.getString("title"));	
							helpData.setOrder_mark(resultJSON2
										.getString("order_mark"));	
							helpData.setUname(resultJSON2
										.getString("uname"));	
							helpData.setPhone(resultJSON2
										.getString("phone"));	
							helpData.setFee(resultJSON2
										.getString("fee"));	
							helpData.setVoucher_fee(resultJSON2
										.getString("voucher_fee"));	
							helpData.setPrice(resultJSON2
										.getString("price"));	
							helpData.setPlan_price(resultJSON2
										.getString("plan_price"));	
							helpData.setType_get_address_name(resultJSON2
										.getString("type_get_address_name"));	
							helpData.setGet_address(resultJSON2
										.getString("get_address"));	
							helpData.setPercentage(resultJSON2
									.getString("percentage"));	
							helpData.setLocation_send(resultJSON2
									.getString("location"));	
							helpData.setLocation_get(resultJSON2
									.getString("location_get"));	
							helpData.setMap_location(resultJSON2
									.getString("map_location"));
							helpData.setStatus("1");	
								
							WaitHelpList.add(helpData);
						}
						waitOderData.setWaithelpData(WaitHelpList);
					} else {
						WaitHelpList = new ArrayList<OrderNewHelpData>();
						helpData = new OrderNewHelpData();
						helpData.setStatus("0");
						helpData.setMessage(message);
						WaitHelpList.add(helpData);
						waitOderData.setWaithelpData(WaitHelpList);
					}
					
				} else if ("0".equals(status)) {
					waitOderData = new WaitQuOrderData();
					waitOderData.setStatus("0");
					waitOderData.setMessage(resultJSON.getString("sucess"));
					waitOderData.setWaitdata(WaitDataList);
				}
			} catch (JSONException e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
				return null;
			}

		} else {
			// 失败处理
			return null;
		}
		return waitOderData;

	}

	/**
	 * 配送中列表
	 * 
	 * @param ince
	 * @param emp_id
	 * @return
	 */
	public static DeliveryOrderData jsonProcess_getSendorderList(
			String ince, String emp_id) {
		DeliveryOrderData oderdata=null;
		ArrayList<OrderDeliveryData> DeliveryDataList = null;
		ArrayList<OrderDeliveryItemData> DeliveryItemList = null;
		ArrayList<OrderNewHelpData> HelpList =null;
		String content = WebHttpHelper.getSendorderList(ince, emp_id);
		if (!"".equals(content) && content != null) {
			OrderDeliveryData SendData = null;
			OrderNewHelpData helpData =null;
			OrderDeliveryItemData SendItemData = null;
			JSONObject resultJSON, resultJSON1,resultJSON2;
			try {
				resultJSON = new JSONObject(content);
				String status = resultJSON.getString("status");
				if ("1".equals(status)) {
					oderdata = new DeliveryOrderData();
					String message = resultJSON.getString("sucess");
					oderdata.setStatus(status);
					oderdata.setMessage(message);
					JSONArray jsonArray = resultJSON.getJSONArray("list");
					JSONArray jsonArray2 = resultJSON.getJSONArray("hlist");
					int iSize = jsonArray.length();
					int iSize2 = jsonArray2.length();
					if (iSize > 0) {
						DeliveryDataList = new ArrayList<OrderDeliveryData>();
						for (int i = 0; i < iSize; i++) {
							resultJSON = jsonArray.getJSONObject(i);
							SendData = new OrderDeliveryData();
							SendData.setItemid(resultJSON.getString("itemid"));
							SendData.setMain_id(resultJSON.getString("main_id"));
							SendData.setEmp_id(resultJSON.getString("emp_id"));
							SendData.setAdd_time(resultJSON
									.getString("add_time"));
							SendData.setTotal(resultJSON.getString("total"));
							SendData.setReturnpay(resultJSON
									.getString("returnpay"));
							SendData.setSendaddress(resultJSON
									.getString("sendaddress"));
							try {
								SendData.setAddress_road(resultJSON
										.getString("address_road"));	//用户详细地址
							} catch(Exception e){}
							SendData.setStatus(resultJSON.getString("status"));
							SendData.setStatus01(status);
							SendData.setMessage(message);

							if (!"".equals(resultJSON.getString("items"))) {
								JSONArray jsonArray1 = resultJSON
										.getJSONArray("items");
								int iSize1 = jsonArray1.length();

								DeliveryItemList = new ArrayList<OrderDeliveryItemData>();
								for (int j = 0; j < iSize1; j++) {
									resultJSON1 = jsonArray1.getJSONObject(j);
									SendItemData = new OrderDeliveryItemData();
									SendItemData.setOrder_id(resultJSON1
											.getString("order_id"));
									SendItemData.setSite_name(resultJSON1
											.getString("site_name"));
									SendItemData.setSite_addr(resultJSON1
											.getString("site_addr"));
									SendItemData.setUname(resultJSON1
											.getString("uname"));
									SendItemData.setPhone(resultJSON1
											.getString("phone"));
									SendItemData.setAdd_time(resultJSON1
											.getString("add_time"));
									SendItemData.setFood_amount(resultJSON1
											.getString("food_amount"));
									// SendItemData.setEmp_id(resultJSON1
									// .getString("emp_id"));
									SendItemData.setStatus(resultJSON1
											.getString("status"));
									try {
										SendItemData.setPhone_addr(resultJSON1
												.getString("phone_addr"));	//用户经纬度
									} catch(Exception e){}
									DeliveryItemList.add(SendItemData);
								}
								SendData.setOrderItemList(DeliveryItemList);
							}
							DeliveryDataList.add(SendData);
						}
						oderdata.setOrderdeliverydata(DeliveryDataList);
					} else {
						DeliveryDataList = new ArrayList<OrderDeliveryData>();
						SendData = new OrderDeliveryData();
						SendData.setStatus01("0");
						SendData.setMessage(message);
						DeliveryDataList.add(SendData);
						oderdata.setOrderdeliverydata(DeliveryDataList);
					}
					
					if(iSize2>0){
						HelpList = new ArrayList<OrderNewHelpData>();
						for (int i = 0; i < iSize2; i++) {
							resultJSON2 = jsonArray2.getJSONObject(i);
							helpData = new OrderNewHelpData();
							helpData.setSend_address(resultJSON2
									.getString("send_address"));
							helpData.setHelp_addtime(resultJSON2
									.getString("add_time"));
							helpData.setShipping_fee(resultJSON2
									.getString("shipping_fee"));
							helpData.setType(resultJSON2
										.getString("type"));	
							helpData.setHelp_order_id(resultJSON2
										.getString("order_id"));	
							helpData.setTitle(resultJSON2
										.getString("title"));	
							helpData.setOrder_mark(resultJSON2
										.getString("order_mark"));	
							helpData.setUname(resultJSON2
										.getString("uname"));	
							helpData.setPhone(resultJSON2
										.getString("phone"));	
							helpData.setFee(resultJSON2
										.getString("fee"));	
							helpData.setVoucher_fee(resultJSON2
										.getString("voucher_fee"));	
							helpData.setPrice(resultJSON2
										.getString("price"));	
							helpData.setPlan_price(resultJSON2
										.getString("plan_price"));	
							helpData.setType_get_address_name(resultJSON2
										.getString("type_get_address_name"));	
							helpData.setGet_address(resultJSON2
										.getString("get_address"));	
							helpData.setPercentage(resultJSON2
									.getString("percentage"));	
							helpData.setLocation_send(resultJSON2
									.getString("location"));	
							helpData.setLocation_get(resultJSON2
									.getString("location_get"));	
							helpData.setMap_location(resultJSON2
									.getString("map_location"));
							helpData.setStatus("1");	
								
							HelpList.add(helpData);
						}
						oderdata.setNewhelpData(HelpList);
					} else {
						HelpList = new ArrayList<OrderNewHelpData>();
						helpData = new OrderNewHelpData();
						helpData.setStatus("0");
						helpData.setMessage(message);
						HelpList.add(helpData);
						oderdata.setNewhelpData(HelpList);
					}
				}else{
					oderdata = new DeliveryOrderData();
					oderdata.setStatus(status);
					oderdata.setMessage(resultJSON.getString("sucess"));
				}
			} catch (JSONException e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
				return null;
			}
		} else {
			// 失败处理
			return null;
		}
		return oderdata;

	}

	/**
	 * 订单详情
	 * 
	 * @param ince
	 * @param main_id
	 * @param emp_id
	 */
	public static OrderdetailData jsonProcess_getorderinfo(String ince,
			String main_id, String emp_id) {
		 String content = WebHttpHelper.orderinfo(ince, main_id, emp_id);
		OrderdetailData detaildata = null;
		 if (!"".equals(content) && content != null) {
		 JSONObject resultJSON;
		 try {
		 resultJSON = new JSONObject(content);
		 String status = resultJSON.getString("status");
		 if ("1".equals(status)) {
		 detaildata = new OrderdetailData();
		 String message = resultJSON.getString("sucess");
		 detaildata.setState("1");
		 detaildata.setMessage(message);
		 resultJSON = resultJSON.getJSONObject("order");
		 detaildata.setMain_id(resultJSON.getString("main_id")); // 主订单号
		 detaildata.setEmp_id(resultJSON.getString("emp_id")); // 快递uid
		 detaildata
		 .setCreat_time(resultJSON.getString("creat_time")); // 抢单时间
		 detaildata.setAdd_time(resultJSON.getString("add_time")); // 下单时间
		 detaildata.setGet_time(resultJSON.getString("get_time")); // 取货时间
		 detaildata.setSend_time(resultJSON.getString("send_time")); // 送达时间
		 detaildata.setSendaddress(resultJSON.getString("sendaddress")); //送达地址
		 detaildata.setReturnpay(resultJSON.getString("returnpay")); // 快递费用
		 detaildata.setTimes(resultJSON.getString("times")); // 送达时长
		 detaildata
		 .setOrder_mark(resultJSON.getString("order_mark")); // 备注
		 detaildata.setStatus(resultJSON.getString("status")); // 主订单状态
		 try {
			 detaildata.setAddress_road(resultJSON.getString("address_road")); //用户详细地址
			} catch (Exception e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
			}
		 JSONArray jsonArray = resultJSON.getJSONArray("items");
		 int iSize = jsonArray.length();
		 ArrayList<OrderdetailSite> sitelist = new
		 ArrayList<OrderdetailSite>();
		 for (int i = 0; i < iSize; i++) {
		 resultJSON = jsonArray.getJSONObject(i);
		 OrderdetailSite sitedata = new OrderdetailSite();
		 sitedata.setOrder_id(resultJSON.getString("order_id")); // 子订单号
		 // sitedata.setEmp_id(resultJSON.getString("emp_id"));
		 sitedata.setSite_name(resultJSON.getString("site_name")); // 店铺名称
		 sitedata.setSite_addr(resultJSON.getString("site_addr")); // 店铺地址
		 sitedata.setSite_phone(resultJSON
		 .getString("site_phone")); // 店铺电话
		 sitedata.setUname(resultJSON.getString("uname")); // 收货人姓名
		 sitedata.setPhone(resultJSON.getString("phone")); // 收货人电话
		 sitedata.setAdd_time(resultJSON.getString("add_time")); // 下单时间
		 // sitedata.setGet_time(resultJSON.getString("get_time")); // 取货
		 // sitedata.setSend_time(resultJSON.getString("send_time")); // 送达
		 sitedata.setFood_amount(resultJSON
		 .getString("food_amount")); // 订单金额
		 sitedata.setPaytype(resultJSON.getString("paytype")); //付款方式
		 sitedata.setStatus(resultJSON.getString("status")); // 子订单状态
		 sitedata.setLng(resultJSON.getString("longitude")); // 纬度
		 sitedata.setLat(resultJSON.getString("latitude")); //经度
		 try {
			sitedata.setPhone_addr(resultJSON.getString("phone_addr")); //用户经纬度
		} catch (Exception e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		
		 if (!"".equals(resultJSON.getString("foods"))) {
		 JSONArray jsonArray1 = resultJSON
		 .getJSONArray("foods");
		 int iSize1 = jsonArray1.length();
		
		 ArrayList<OrderdetailFood> foodlist = new
		 ArrayList<OrderdetailFood>();
		 for (int j = 0; j < iSize1; j++) {
		 JSONObject resultJSON1 = jsonArray1
		 .getJSONObject(j);
		 OrderdetailFood food = new OrderdetailFood();
		 food.setFname(resultJSON1.getString("fname"));
		 food.setQuantity(resultJSON1
		 .getString("quantity"));
		 food.setPrice(resultJSON1.getString("price"));
		 foodlist.add(food);
		 }
		 sitedata.setFoodlist(foodlist);
		 }
		 sitelist.add(sitedata);
		 }
		 detaildata.setSitelist(sitelist);
		 } else if ("0".equals(status)) {
		 String message = resultJSON.getString("fail");
		 detaildata = new OrderdetailData();
		 detaildata.setState("0");
		 detaildata.setMessage(message);
		 }
		 } catch (JSONException e) {
		 // TODO Auto-generated catch block
		 e.printStackTrace();
		 return null;
		 }
		 } else {
		 // 失败处理
		 return null;
		 }
		return detaildata;

	}

	/**
	 * 快速点击抢单
	 * 
	 * @param ince
	 * @param main_id
	 * @param emp_id
	 * @return
	 */
	public static QiangDanData jsonProcess_getQsQiang(String ince,
			String main_id, String emp_id) {
		QiangDanData qiangdan = null;
		String content = WebHttpHelper.getQsQiang(ince, main_id, emp_id);
		Log.v("sd", "qscontent1 = "+content);
		if (!"".equals(content) && content != null) {
			JSONObject resultJSON;
			try {
				resultJSON = new JSONObject(content);
				String status = resultJSON.getString("status");
				String Message = "";
				qiangdan = new QiangDanData();
				if (status.equals("1")) {
					Message = resultJSON.getString("sucess");
				}else if(status.equals("99")){
					qiangdan.setReturn_time(resultJSON.getString("return_time"));
					qiangdan.setOrder_id(resultJSON.getString("order_id"));
					Message = resultJSON.getString("fail");
					
				} else {
					Message = resultJSON.getString("fail");
				}
				qiangdan.setStatus(status);
				qiangdan.setMessage(Message);

			} catch (JSONException e) {
				e.printStackTrace();
				return null;
			}

		} else {
			return null;
		}
		return qiangdan;

	}
	/**
	 * 随意购——点击抢单
	 * 
	 * @param ince
	 * @param main_id
	 * @param emp_id
	 * @return
	 */
	public static QiangDanData jsonProcess_getHelpQsQiang(String ince,
			String main_id, String emp_id) {
		QiangDanData qiangdan = null;
		String content = WebHttpHelper.getHelpQsQiang(ince, main_id, emp_id);
		if (!"".equals(content) && content != null) {
			JSONObject resultJSON;
			try {
				resultJSON = new JSONObject(content);
				String status = resultJSON.getString("ret");
				String Message = "";
				qiangdan = new QiangDanData();
				if (status.equals("200")) {
					Message = resultJSON.getString("msg");
					qiangdan.setStatus(status);
					qiangdan.setMessage(Message);
				} else {
					Message = resultJSON.getString("msg");
					qiangdan.setStatus("0");
					qiangdan.setMessage(Message);
				}
				
			} catch (JSONException e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
				return null;
			}
			
		} else {
			return null;
		}
		return qiangdan;
		
	}

	/**
	 * 确认取货
	 * 
	 * @param ince
	 * @param order_id
	 * @param emp_id
	 * @return
	 */
	public static QiangDanData jsonProcess_getQsgetfood(String ince,
			String order_id, String emp_id) {
		QiangDanData qiangdan = null;
		String content = WebHttpHelper.getfood(ince, order_id, emp_id);
		if (!"".equals(content) && content != null) {
			JSONObject resultJSON;
			try {
				resultJSON = new JSONObject(content);
				String status = resultJSON.getString("status");
				String Message = "";
				qiangdan = new QiangDanData();
				if (status.equals("1")) {
					Message = resultJSON.getString("sucess");
					qiangdan.setStatus(status);
					qiangdan.setMessage(Message);
				} else {
					Message = resultJSON.getString("fail");
					qiangdan.setStatus(status);
					qiangdan.setMessage(Message);
				}

			} catch (JSONException e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
				return null;
			}

		} else {
			return null;
		}
		return qiangdan;

	}

	/**
	 * 获取已完成订单列表
	 * 
	 * @param ince
	 * @param emp_id
	 * @param page
	 * @return
	 */
	public static OrderOverData jsonProcess_getoverOrd(String ince,
			String emp_id, String page) {
		String content = WebHttpHelper.getoverOrd(ince, emp_id, page);
		OrderOverData detaildata = null;
		if (!"".equals(content) && content != null) {
			JSONObject resultJSON;
			try {
				resultJSON = new JSONObject(content);
				String status = resultJSON.getString("status");
				if ("1".equals(status)) {
					detaildata = new OrderOverData();
					String message = resultJSON.getString("sucess");
					detaildata.setStatus("1");
					detaildata.setMessage(message);
					detaildata.setTotal(resultJSON.getString("total"));
					detaildata.setNumber(resultJSON.getString("number"));

					if (!"null".equals(resultJSON.getString("list"))
							&& !"".equals(resultJSON.getString("list"))) {
						JSONArray jsonArray = resultJSON.getJSONArray("list");
						int iSize = jsonArray.length();
						ArrayList<OrderoverDay> daylist = new ArrayList<OrderoverDay>();
						for (int i = 0; i < iSize; i++) {
							resultJSON = jsonArray.getJSONObject(i);
							OrderoverDay daydata = new OrderoverDay();
							daydata.setDate(resultJSON.getString("date")); // 日期
							daydata.setCount(resultJSON.getString("count")); // 每天完成数量

							ArrayList<OrderoverOrd> ordlist = new ArrayList<OrderoverOrd>();
							if (!"".equals(resultJSON.getString("orders"))) {
								JSONArray jsonArray1 = resultJSON
										.getJSONArray("orders");
								int iSize1 = jsonArray1.length();
								for (int j = 0; j < iSize1; j++) {
									JSONObject resultJSON1 = jsonArray1
											.getJSONObject(j);
									OrderoverOrd orddata = new OrderoverOrd();
									orddata.setMain_id(resultJSON1
											.getString("main_id")); // 主订单号
									orddata.setReturnpay(resultJSON1
											.getString("returnpay")); // 配送费
									orddata.setSendaddress(resultJSON1
											.getString("sendaddress"));
									orddata.setSitelist(resultJSON1
											.getString("items")); // 子商铺名称
									ordlist.add(orddata);
								}
							}
							daydata.setOrderlist(ordlist);
							daylist.add(daydata);
						}
						detaildata.setDaylist(daylist);
					}

				} else if ("0".equals(status)) {
					String message = resultJSON.getString("fail");
					detaildata = new OrderOverData();
					detaildata.setStatus("0");
					detaildata.setMessage(message);
				}
			} catch (JSONException e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
				return null;
			}
		} else {
			// 失败处理
			return null;
		}
		return detaildata;

	}

	/**
	 * 人人便利确认送达
	 * @param ince
	 * @param order_id
	 * @param emp_id
	 * @return
	 */
	public static QiangDanData jsonProcess_getQsSendFood(String ince,
			String order_id, String emp_id) {
		QiangDanData qiangdan = null;
		String content = WebHttpHelper.getQsSendFood(ince, order_id, emp_id);
		if (!"".equals(content) && content != null) {
			JSONObject resultJSON;
			try {
				resultJSON = new JSONObject(content);
				String status = resultJSON.getString("status");
				String Message = "";
				qiangdan = new QiangDanData();
				if (status.equals("1")) {
					Message = resultJSON.getString("sucess");
					qiangdan.setStatus(status);
					qiangdan.setMessage(Message);
				} else {
					Message = resultJSON.getString("fail");
					qiangdan.setStatus(status);
					qiangdan.setMessage(Message);
				}

			} catch (JSONException e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
				return null;
			}

		} else {
			return null;
		}
		return qiangdan;

	}
	/**
	 * 随意购确认送达
	 * @param ince
	 * @param order_id
	 * @param emp_id
	 * @return
	 */
	public static QiangDanData jsonProcess_getQsExSendFood(String ince,
			String order_id, String emp_id) {
		QiangDanData qiangdan = null;
		String content = WebHttpHelper.getQsEXSendFood(ince, order_id, emp_id);
		if (!"".equals(content) && content != null) {
			JSONObject resultJSON;
			try {
				resultJSON = new JSONObject(content);
				String status = resultJSON.getString("ret");
				String Message = "";
				qiangdan = new QiangDanData();
				if (status.equals("200")) {
					Message = resultJSON.getString("msg");
					qiangdan.setStatus(status);
					qiangdan.setMessage(Message);
				} else {
					Message = resultJSON.getString("msg");
					qiangdan.setStatus(status);
					qiangdan.setMessage(Message);
				}
				
			} catch (JSONException e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
				return null;
			}
			
		} else {
			return null;
		}
		return qiangdan;
		
	}

	/**
	 * 获取快递员信息
	 * 
	 * @param ince
	 * @param uname
	 * @param passwd
	 */
	public static UserData jsonProcess_getQsinfo(String ince, String emp_id) {
		String content = WebHttpHelper.getQsinfo(ince, emp_id);
		UserData userdata = null;
		if (!"".equals(content) && content != null) {
			JSONObject resultJSON;
			try {
				resultJSON = new JSONObject(content);
				if ("1".equals(resultJSON.getString("status"))
						&& !"".equals(resultJSON.getString("info"))) {
					userdata = new UserData();
					userdata.setStatus("1");
					userdata.setMessage(resultJSON.getString("sucess"));

					resultJSON = resultJSON.getJSONObject("info");
					userdata.setUid(resultJSON.getString("uid"));
					userdata.setRealname(resultJSON.getString("realname"));
					userdata.setPhone(resultJSON.getString("phone"));
					userdata.setAccount(resultJSON.getString("account"));
					userdata.setClose(resultJSON.getString("close"));
					userdata.setQsstatus(resultJSON.getString("status"));

					userdata.setDataline(resultJSON.getString("dataline"));
					userdata.setLat(resultJSON.getString("lat"));
					userdata.setLng(resultJSON.getString("lng"));
					userdata.setBank(resultJSON.getString("bank"));
					userdata.setBank_name(resultJSON.getString("bank_name"));
					userdata.setFreeze_account(resultJSON
							.getString("freeze_account"));

				} else if ("0".equals(resultJSON.getString("status"))) {
					// 获取信息错误
					userdata = new UserData();
					userdata.setStatus("0");
					userdata.setMessage(resultJSON.getString("fail"));
				}
			} catch (JSONException e) {
				e.printStackTrace();
				return null;
			}

		} else {
			// 失败处理
			return null;
		}
		return userdata;
	}

	/**
	 * 设置快递开收工
	 * 
	 * @param ince
	 * @param emp_id
	 * @param close
	 * @return
	 */
	public static QiangDanData jsonProcess_setqsopen(String ince,
			String emp_id, String close) {
		QiangDanData qiangdan = null;
		String content = WebHttpHelper.setqsOpen(ince, emp_id, close);
		if (!"".equals(content) && content != null) {
			JSONObject resultJSON;
			try {
				resultJSON = new JSONObject(content);
				String status = resultJSON.getString("status");
				String Message = "";
				qiangdan = new QiangDanData();
				if (status.equals("1")) {
					Message = resultJSON.getString("sucess");
					qiangdan.setStatus(status);
					qiangdan.setMessage(Message);
				} else {
					Message = resultJSON.getString("fail");
					qiangdan.setStatus(status);
					qiangdan.setMessage(Message);
				}

			} catch (JSONException e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
				return null;
			}

		} else {
			return null;
		}
		return qiangdan;

	}

	/**
	 * 更新骑士坐标
	 * 
	 * @param ince
	 * @param emp_id
	 * @param lat
	 * @param lng
	 * @return
	 */
	public static QiangDanData jsonProcess_setEmpLocation(String ince,
			String emp_id, String lat, String lng) {
		QiangDanData qiangdan = null;
		String content = WebHttpHelper.setEmpLocation(ince, emp_id, lat, lng);
		if (!"".equals(content) && content != null) {
			JSONObject resultJSON;
			try {
				resultJSON = new JSONObject(content);
				String status = resultJSON.getString("status");
				String Message = "";
				qiangdan = new QiangDanData();
				if (status.equals("1")) {
					Message = resultJSON.getString("sucess");
					qiangdan.setStatus(status);
					qiangdan.setMessage(Message);
				} else {
					Message = resultJSON.getString("fail");
					qiangdan.setStatus(status);
					qiangdan.setMessage(Message);
				}

			} catch (JSONException e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
				return null;
			}

		} else {
			return null;
		}
		return qiangdan;

	}

	/**
	 * 获取订单数量
	 * 
	 * @param ince
	 * @param emp_id
	 * @return
	 */
	public static QiangDanData jsonProcess_getOrderCount(String ince,
			String emp_id) {
		QiangDanData qiangdan = null;
		String content = WebHttpHelper.getOrderCount(ince, emp_id);
		if (!"".equals(content) && content != null) {
			JSONObject resultJSON;
			try {
				resultJSON = new JSONObject(content);
				String status = resultJSON.getString("status");
				String Message = "";
				qiangdan = new QiangDanData();
				if (status.equals("1")) {
					Message = resultJSON.getString("sucess");
					qiangdan.setStatus(status);
					qiangdan.setMessage(Message);
					qiangdan.setNeworder(resultJSON.getString("neworder"));
					qiangdan.setNoget(resultJSON.getString("noget"));
					qiangdan.setNosend(resultJSON.getString("nosend"));
				} else {
					Message = resultJSON.getString("fail");
					qiangdan.setStatus(status);
					qiangdan.setMessage(Message);
				}

			} catch (JSONException e) {
				e.printStackTrace();
				return null;
			}

		} else {
			return null;
		}
		return qiangdan;

	}

	/**
	 * 配送员提现申请
	 * 
	 * @param ince
	 * @param emp_id
	 * @param amount
	 * @return
	 */
	public static QiangDanData jsonProcess_getDeposit(String ince,
			String emp_id, String amount) {
		QiangDanData qiangdan = null;
		String content = WebHttpHelper.getDeposit(ince, emp_id, amount);
		if (!"".equals(content) && content != null) {
			JSONObject resultJSON;
			try {
				resultJSON = new JSONObject(content);
				String status = resultJSON.getString("status");
				String Message = "";
				qiangdan = new QiangDanData();
				if (status.equals("1")) {
					Message = resultJSON.getString("sucess");
					qiangdan.setStatus(status);
					qiangdan.setMessage(Message);

				} else {
					Message = resultJSON.getString("fail");
					qiangdan.setStatus(status);
					qiangdan.setMessage(Message);
				}

			} catch (JSONException e) {
				e.printStackTrace();
				return null;
			}

		} else {
			return null;
		}
		return qiangdan;

	}

	/**
	 * 获取配送员账户明细和用户体现明细
	 * 
	 * @param ince
	 * @param emp_id
	 * @param page
	 * @return
	 */
	public static ArrayList<UserDetailsData> jsonProcess_getEmpAccountlog(
			String ince, String emp_id, String page) {
		ArrayList<UserDetailsData> DetailsList = null;
		String content = WebHttpHelper.getEmpAccountlog(ince, emp_id, page);
		if (!"".equals(content) && content != null) {
			UserDetailsData SendData = null;
			JSONObject resultJSON;
			try {
				resultJSON = new JSONObject(content);
				String status = resultJSON.getString("status");
				if ("1".equals(resultJSON.getString("status"))) {
					String message = resultJSON.getString("sucess");
					String total = resultJSON.getString("total");
					String number = resultJSON.getString("number");
					JSONArray jsonArray = resultJSON.getJSONArray("list");
					int iSize = jsonArray.length();
					if (iSize > 0) {
						DetailsList = new ArrayList<UserDetailsData>();
						for (int i = 0; i < iSize; i++) {
							resultJSON = jsonArray.getJSONObject(i);
							SendData = new UserDetailsData();
							SendData.setMark(resultJSON.getString("mark"));
							SendData.setAmount(resultJSON.getString("amount"));
							SendData.setCreat_time(resultJSON
									.getString("creat_time"));
							SendData.setTotal(total);
							SendData.setNumber(number);
							SendData.setStatus(status);
							SendData.setMessage(message);

							DetailsList.add(SendData);
						}
					} else {
						DetailsList = new ArrayList<UserDetailsData>();
						SendData = new UserDetailsData();
						SendData.setTotal(total);
						SendData.setNumber(number);
						SendData.setStatus("0");
						SendData.setMessage(message);
						DetailsList.add(SendData);
					}
				} else if ("0".equals(status)) {
					String message = resultJSON.getString("fail");
					DetailsList = new ArrayList<UserDetailsData>();
					SendData = new UserDetailsData();
					SendData.setStatus(status);
					SendData.setMessage(message);
					DetailsList.add(SendData);
				}
			} catch (JSONException e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
				return null;
			}
		} else {
			// 失败处理
			return null;
		}
		return DetailsList;

	}
	
	
	/**
	 * 万能跑腿订单详情
	 * @param ince
	 * @param order_id
	 * @param emp_id
	 * @return
	 */
	public static SygOrdetailData jsonProcess_sygorderinfo(String ince,
			String order_id, String emp_id) {
		String content = WebHttpHelper.sygorderinfo(ince, order_id, emp_id);
		SygOrdetailData detaildata = null;
		if (!"".equals(content) && content != null) {
			JSONObject resultJSON;
			try {
				resultJSON = new JSONObject(content);
				String status = resultJSON.getString("ret");
				if ("200".equals(status)) { // 成功
					detaildata = new SygOrdetailData();
					String message = resultJSON.getString("msg");
					detaildata.setRet("200");
					detaildata.setMsg(message);
					resultJSON = resultJSON.getJSONObject("data");
					detaildata.setOrder_id(resultJSON.getString("order_id")); // 订单号
					detaildata.setType(resultJSON.getString("type"));
					detaildata.setStatus(resultJSON.getString("status"));//订单状态
					detaildata.setPaytype(resultJSON.getString("paytype"));
					detaildata.setTitle(resultJSON.getString("title"));
					detaildata.setWeight(resultJSON.getString("weight"));
					detaildata.setPrice(resultJSON.getString("price"));
					detaildata.setPrice_kind(resultJSON.getString("price_kind"));
					detaildata.setUname(resultJSON.getString("uname")); // 收货人姓名
					detaildata.setPhone(resultJSON.getString("phone")); // 收货人电话
					detaildata.setAddress(resultJSON.getString("address"));
					detaildata.setMap_location(resultJSON.getString("map_location"));
					detaildata.setBuy_addr(resultJSON.getString("buy_addr"));
					detaildata.setBuy_road(resultJSON.getString("buy_road"));
					detaildata.setBuy_lat(resultJSON.getString("buy_lat"));
					detaildata.setBuy_lng(resultJSON.getString("buy_lng"));
					
					detaildata.setVoucher_fee(resultJSON.getString("voucher_fee"));
					detaildata.setShipping_fee(resultJSON.getString("shipping_fee"));
					detaildata.setFee(resultJSON.getString("fee"));
					detaildata.setTotal_fee(resultJSON.getString("total_fee"));
					
					detaildata.setCheck_time(resultJSON.getString("check_time")); // 抢单时间
					detaildata.setAdd_time(resultJSON.getString("add_time")); // 下单时间
					detaildata.setGet_time(resultJSON.getString("get_time")); // 取货时间
					detaildata.setSend_time(resultJSON.getString("send_time")); // 送达时间
					detaildata.setSpendtime(resultJSON.getString("spendtime")); // 送达时长
					detaildata
							.setOrder_mark(resultJSON.getString("order_mark")); // 备注
					
					detaildata.setSend_lat(resultJSON.getString("send_lat"));
					detaildata.setSend_lng(resultJSON.getString("send_lng"));
					detaildata.setGet_addr(resultJSON.getString("get_addr"));
					detaildata.setGet_road(resultJSON.getString("get_road"));
					detaildata.setGet_lat(resultJSON.getString("get_lat"));
					detaildata.setGet_lng(resultJSON.getString("get_lng"));
					
				} else {
					detaildata = new SygOrdetailData();
					detaildata.setRet(resultJSON.getString("ret"));
					detaildata.setMsg(resultJSON.getString("msg"));
				}
			} catch (JSONException e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
				return null;
			}
		} else {
			// 失败处理
			return null;
		}
		return detaildata;
	}
	
	/**
	 * 万能跑腿确认取货
	 * 
	 * @param ince
	 * @param order_id
	 * @param emp_id
	 * @return
	 */
	public static QiangDanData jsonProcess_getexgetfood(String ince,
			String order_id, String emp_id) {
		QiangDanData qiangdan = null;
		String content = WebHttpHelper.exgetfood(ince, order_id, emp_id);
		if (!"".equals(content) && content != null) {
			JSONObject resultJSON;
			try {
				resultJSON = new JSONObject(content);
				String status = resultJSON.getString("ret");
				String Message = "";
				qiangdan = new QiangDanData();
				if (status.equals("200")) {//成功
					Message = resultJSON.getString("msg");
					qiangdan.setStatus(status);
					qiangdan.setMessage(Message);
				} else {
					Message = resultJSON.getString("msg");
					qiangdan.setStatus(status);
					qiangdan.setMessage(Message);
				}

			} catch (JSONException e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
				return null;
			}

		} else {
			return null;
		}
		return qiangdan;

	}
	
	
	/**
	 * 获取已完成订单列表
	 * 
	 * @param ince
	 * @param emp_id
	 * @param page
	 * @return
	 */
	public static OrderOverData jsonProcess_syggetoverOrd(String ince,
			String emp_id, String page) {
		String content = WebHttpHelper.getsygoverOrd(ince, emp_id, page);
		OrderOverData detaildata = null;
		if (!"".equals(content) && content != null) {
			JSONObject resultJSON;
			try {
				resultJSON = new JSONObject(content);
				String status = resultJSON.getString("ret");
				if ("200".equals(status)) {	//成功
					detaildata = new OrderOverData();
					String message = resultJSON.getString("msg");
					detaildata.setStatus("200");
					detaildata.setMessage(message);
					detaildata.setTotal(resultJSON.getString("count"));
					detaildata.setNumber(resultJSON.getString("number"));

					if (!"null".equals(resultJSON.getString("data"))
							&& !"".equals(resultJSON.getString("data"))) {
						JSONArray jsonArray = resultJSON.getJSONArray("data");
						int iSize = jsonArray.length();
						ArrayList<SygOrdOverData> sygordlist = new ArrayList<SygOrdOverData>();
						for (int i = 0; i < iSize; i++) {
							resultJSON = jsonArray.getJSONObject(i);
							SygOrdOverData data = new SygOrdOverData();
							data.setOrder_id(resultJSON.getString("order_id"));
							data.setType(resultJSON.getString("type"));
							data.setTitle(resultJSON.getString("title"));
							data.setAddress(resultJSON.getString("address"));
							data.setMap_location(resultJSON.getString("map_location"));
							data.setAddtime(resultJSON.getString("add_time"));
							try {
								data.setPercentage(resultJSON.getString("percentage"));
							} catch(Exception e){
								data.setPercentage("");
							}

							sygordlist.add(data);
						}
						detaildata.setSygordlist(sygordlist);
					}

				} else {
					detaildata = new OrderOverData();
					detaildata.setStatus(resultJSON.getString("ret"));
					detaildata.setMessage(resultJSON.getString("msg"));
				}
			} catch (JSONException e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
				return null;
			}
		} else {
			// 失败处理
			return null;
		}
		return detaildata;

	}
	
	/**
	 * 获取新版本信息
	 * @param ince
	 * @return
	 */
	public static NewVersionData jsonProcess_getnewverion(String ince) {
		String content = WebHttpHelper.getNewVersion(ince);
		NewVersionData detaildata = null;
		if (!"".equals(content) && content != null) {
			JSONObject resultJSON;
			try {
				resultJSON = new JSONObject(content);
				detaildata = new NewVersionData();
				detaildata.setVersion(resultJSON.getString("version"));
				detaildata.setDown_url(resultJSON.getString("down_url"));
				detaildata.setNote(resultJSON.getString("note"));
				
			} catch (JSONException e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
				return null;
			}
		} else {
			// 失败处理
			return null;
		}
		return detaildata;

	}
	
	/**
	 * 获取骑士的统计数据
	 * @param ince
	 * @param time
	 * @param type
	 * @return
	 */
	public static ArrayList<PaihData> jsonProcess_getqstotalph(
			String ince, String time, String type) {
		ArrayList<PaihData> DetailsList = null;
		String content = WebHttpHelper.getqstotalph(ince, time, type);
		if (!"".equals(content) && content != null) {
			PaihData SendData = null;
			JSONObject resultJSON;
			try {
				resultJSON = new JSONObject(content);
				String status = resultJSON.getString("status");
				if ("1".equals(resultJSON.getString("status"))) {
					String message = resultJSON.getString("fail");
					JSONArray jsonArray = resultJSON.getJSONArray("data");
					int iSize = jsonArray.length();
					if (iSize > 0) {
						DetailsList = new ArrayList<PaihData>();
						for (int i = 0; i < iSize; i++) {
							resultJSON = jsonArray.getJSONObject(i);
							SendData = new PaihData();
							SendData.setStatus(status);
							SendData.setEmp_id(resultJSON.getString("emp_id"));
							SendData.setRealname(resultJSON.getString("realname"));
							SendData.setTotal(resultJSON.getString("total"));
							SendData.setArea_name(resultJSON.getString("area_name"));
							SendData.setSort_order(resultJSON.getString("sort_order"));	//排名
							DetailsList.add(SendData);
						}
					}
				} else {
					String message = resultJSON.getString("fail");
					DetailsList = new ArrayList<PaihData>();
					SendData = new PaihData();
					SendData.setStatus(status);
					SendData.setFail(message);
					DetailsList.add(SendData);
				}
			} catch (JSONException e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
				return null;
			}
		} else {
			// 失败处理
			return null;
		}
		return DetailsList;

	}
	
	
	/**
	 * 我的统计(单个骑士)
	 * @param ince
	 * @param empid
	 * @param time
	 * @return
	 */
	public static MytjData jsonProcess_getoneqstotal(String ince, String empid,
			String time) {
		MytjData mytjdata = null;
		String content = WebHttpHelper.getoneqstotal(ince, empid, time);
		if (!"".equals(content) && content != null) {
			mytjdata = new MytjData(); 
			JSONObject resultJSON;
			try {
				resultJSON = new JSONObject(content);
				String status = resultJSON.getString("status");
				if (status!=null && "1".equals(status)) {
					mytjdata.setStatus("1");
					resultJSON = resultJSON.getJSONObject("data");
					JSONObject c4obj = resultJSON.getJSONObject("c40");
					mytjdata.setC4total(c4obj.getString("total"));
					mytjdata.setC4note(c4obj.getString("note"));
					JSONObject c6obj = resultJSON.getJSONObject("c60");
					mytjdata.setC6total(c6obj.getString("total"));
					mytjdata.setC6note(c6obj.getString("note"));
					JSONObject allobj = resultJSON.getJSONObject("all");
					mytjdata.setAlltotal(allobj.getString("total"));
					mytjdata.setAllnote(allobj.getString("note"));
					mytjdata.setAllscortorder(allobj.getString("sort_order"));
					try {
						JSONObject scoreobj = resultJSON.getJSONObject("score");
						mytjdata.setScoretotal(scoreobj.getString("total"));
						mytjdata.setScorenote(scoreobj.getString("note"));
						mytjdata.setScoresortorder(scoreobj.getString("sort_order"));
					} catch(Exception e) {}
					JSONObject rateobj = resultJSON.getJSONObject("rate");
					mytjdata.setRatetotal(rateobj.getString("total"));
					mytjdata.setRatenote(rateobj.getString("note"));
					mytjdata.setRatesortorder(rateobj.getString("sort_order"));
					
				} else {
					String message = resultJSON.getString("fail");
					mytjdata.setStatus(status);
					mytjdata.setFail(message);
				}
			} catch (JSONException e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
				return null;
			}
		} else {
			// 失败处理
			return null;
		}
		return mytjdata;

	}

}
